package io.renren.modules.user.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.user.entity.TAppplyProcessEntity;
import io.renren.modules.user.service.TAppplyProcessService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 审批流程表
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2019-08-08 12:18:58
 */
@RestController
@RequestMapping("/tappplyprocess")
public class TAppplyProcessController {
    @Autowired
    private TAppplyProcessService tAppplyProcessService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("generator:tappplyprocess:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tAppplyProcessService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("generator:tappplyprocess:info")
    public R info(@PathVariable("id") Integer id){
		TAppplyProcessEntity tAppplyProcess = tAppplyProcessService.getById(id);

        return R.ok().put("tAppplyProcess", tAppplyProcess);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("generator:tappplyprocess:save")
    public R save(@RequestBody TAppplyProcessEntity tAppplyProcess){
		tAppplyProcessService.save(tAppplyProcess);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("generator:tappplyprocess:update")
    public R update(@RequestBody TAppplyProcessEntity tAppplyProcess){
		tAppplyProcessService.updateById(tAppplyProcess);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("generator:tappplyprocess:delete")
    public R delete(@RequestBody Integer[] ids){
		tAppplyProcessService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
